<template>
<div class="charts" ref="charts"></div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  name: 'lineChart' ,
   data () { 
      return {}
    },
    mounted() {
      let lineCharts = echarts.init(this.$refs.charts)
      lineCharts.setOption({
        xAxis: {
          show: false,
          type: 'category'
        },
        yAxis: {
          show: false,
        },
        // 图标距离网格的距离
        grid: {
          // show: true,
          top: 0,
          right: 0,
          bottom: 0,
          left: 0
        },
        series: [
          {
            type: 'line',
            data: [30, 35, 30, 15, 15, 50, 15, 50],
            // 隐藏拐点
            itemStyle: {
              opacity: 0
            },
            // 线条颜色
            lineStyle: {
              color: 'purple'
            },
            // 区域样式
            areaStyle: {
              // 渐变色
              color: {
                type: 'linear',
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [{
                    offset: 0, color: 'purple' // 0% 处的颜色
                }, {
                    offset: 1, color: '#fff' // 100% 处的颜色
                }],
                global: false // 缺省为 false
              },
            },
            // 过渡效果
            smooth: true,
          }
        ]
      })
    }

}
</script>

<style scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
